package com.zc.study.thread.多线程第二章节.thread2_1_5;

/**
 * 共享资源类
 */
public class Communion {
    synchronized public void  methodA(){
        System.out.println("资源A已进入");
        try {
            Thread.sleep(5000);
            System.out.println("MethodA end");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    //synchronized public void methodB(){
     public void methodB(){
        System.out.println("资源B已经进入");
        try {
            Thread.sleep(5000);
            System.out.println("MethodB end");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
